﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lion.WeiXin.Core.Data
{
   public interface IArticle
    {
        /// <summary>
        /// 得到最大ID+1
        /// </summary>
        int GetMaxId();
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        bool Exists(int AID);
        bool Exists(string title);
        /// <summary>
        /// 增加一条数据
        /// </summary>
        int Add(Models.ArticleModel model);
        /// <summary>
        /// 更新一条数据
        /// </summary>
        bool Update(Models.ArticleModel model);
        /// <summary>
        /// 删除一条数据
        /// </summary>
        bool Delete(int AID);
        bool DeleteList(string AIDlist);
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        Models.ArticleModel GetModel(int AID);
        /// <summary>
        /// 获得数据列表
        /// </summary>
        List< Models.ArticleModel> GetList(string strWhere);
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        List<Models.ArticleModel> GetList(int Top, string strWhere, string filedOrder);
        int GetRecordCount(string strWhere);
        List<Models.ArticleModel> GetListByPage(string strWhere, string orderby, int startIndex, int endIndex);
        /// <summary>
        /// 调用存储过程获取分页数据，适合数据量大的表
        /// </summary>
        /// <param name="PageSize">分页大小，如一页10记录</param>
        /// <param name="PageIndex">当前页数</param>
        /// <param name="strWhere">查询条件，不带where</param>
        /// <returns></returns>
        List<Models.ArticleModel> GetList(int PageSize, int PageIndex, string strWhere);
    }
}
